import React, { Component } from 'react';
import SearchContext from '@/pages/class/context/searchContext';

export default class Consumer extends Component{
  constructor(props) {
    super(props);

  }

  render() {
    return (
      <div>
        <SearchContext.Consumer>
          {
            ({state,dispatch})=>(
              <h1 onClick={()=>dispatch({type:'TEXT',payload:'consumerTest'})}>consumer:{state.text}</h1>
            )
          }
        </SearchContext.Consumer>
      </div>
    );
  }

}
